package it.test.java.function;

import java.util.HashSet;
import java.util.Set;

/**
 * 找出数组中相加等于target的两个元素，返回下表
 *
 * @Copyright 纳新智能科技有限公司
 * @Author Liky
 * @Date 2023/2/14
 */
public class Solution5 {
    public int missingNumber(int[] nums) {
        Set<Object> set = new HashSet<>();
        for (int num : nums) {
            set.add(num);
        }
        for (int a = 0; a <= nums.length; a++) {
            if(!set.contains(a)){
                return a;
            }
        }
        return 0;
    }
}
